package com.xbk.seckill.ratelimiter.concurrent.policy;

import com.xbk.seckill.common.exception.ErrorCode;
import com.xbk.seckill.common.exception.SeckillException;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 自定义限流拒绝策略
 *
 * @author xiexu
 * @date 2025/05/07 14:36
 */
public class ConcurrentRateLimiterPolicy implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        throw new SeckillException(ErrorCode.RETRY_LATER);
    }

}
